package operation;

import data.DataBase;

public class SampleEnter implements IOperation {
    @Override
    public void work(DataBase dataBase) {
        System.out.println("采样信息录入！");
        System.out.print("请输入手机尾号后四位：");
        String temPhone = scanner.nextLine();

        int currentSize=dataBase.getContainSize();
        for (int i = 0; i < currentSize; i++) {
            String splitPhone = dataBase.getData(i).getPhone().substring(dataBase.getData(i).getPhone().length()-4);
            if (temPhone.equals(splitPhone)) {
                dataBase.getData(i).setSampled(true);
                System.out.println("手机尾号为"+splitPhone+" 已采样完毕！");
                return;
            }
        }
        System.out.println("未找到尾号为"+temPhone+"的预约信息，采样失败!");
//        if(tmpPhone.equals())
    }

}
